#include "player.h"


Player::Player(Sprite* graphic) : m_x(200), m_y(200), m_jumping_height(0), m_jumping_speed(4)
{
	m_graphic = graphic;
}

Player::~Player()
{
}

void Player::load()
{
	m_graphic->draw(m_x, m_y);
}

void Player::moveRight()
{
	m_x += 3;
	m_graphic->draw(m_x, m_y);
}

void Player::moveLeft()
{
	m_x -= 3;
	m_graphic->draw(m_x, m_y);
}

void Player::jump(const Uint32* dt)
{	
	m_jumping_height += (m_jumping_speed * ((*dt)* 0.001));
	printf("m_jumping_height:%f, %f\n", m_jumping_height,(*dt)*0.001);
	m_jumping_speed -= (((*dt) * 0.001) * 9.8);
	m_graphic->draw(m_x, m_y + m_jumping_height);

}

void Player::moveDown()
{
	m_y -= 3;
	m_graphic->draw(m_x, m_y);
}